package com.wfh.parse;

import java.util.HashMap;
import java.util.Map;

import java.util.List;


import org.json.JSONException;
import org.json.JSONObject;

import com.wfh.bean.TicketsBean;

public class T_QTickets implements TransForm{
	
	public List<TicketsBean> pareseJsonArray(String json){
		return null;
	}

	@Override
	public Map<String,String> pareseJsonObject(String json) {
		Map<String,String> map=new HashMap<String,String>();
		try {
			JSONObject jsonObject = new JSONObject(json);
			map.put("ret", jsonObject.getString("ret"));

		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return map;
	}

	@Override
	public TicketsBean pareseJsonBean(String json) {
		TicketsBean bean=new TicketsBean();
		try {
			JSONObject obj = new JSONObject(json);
			JSONObject jsonObject =obj.getJSONObject("info");
				bean.setExp_date(jsonObject.getString("exp_date"));
				bean.setJuan_name(jsonObject.getString("juan_name"));
				bean.setReal_money(jsonObject.getString("real_money"));
				bean.setReduce_money(jsonObject.getString("reduct_money"));
				bean.setCode(jsonObject.getString("code"));
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		return bean;
	}
	
}
